home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18444 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  825 b 

  1. Path: news.halcyon.com!usenet
  2. From: normanb@halcyon.com (Norm Bryar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: stream question
  5. Date: Sat, 20 Apr 1996 15:35:56 GMT
  6. Organization: Northwest Nexus Inc.
  7. Message-ID: <4lb07d$5m6@news.halcyon.com>
  8. References: <NEWTNews.829954661.22104.ger@kayak.fsl.wvnet.edu>
  9. NNTP-Posting-Host: blv-pm2-ip16.halcyon.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. George Racin <george@gypsy.fsl.wvnet.edu> wrote:
  13.  
  14.  
  15. >If name is equal to  "Ben Eric Smith" and is on one line of an ASCII text file
  16. >and I have the following code, how do I get the entire line into name, rather
  17. >than just "Ben".
  18. >Thanks in advance.
  19.  
  20. >{
  21. >  char name[20];
  22.  
  23. >  ifstream inpstream(fileName);
  24. >  inpstream >> name;
  25. >}
  26.  
  27. >george@gypsy.fsl.wvnet.edu
  28.  
  29. ifstream derives from istream.  Use istream::getline(). 
  30. Good luck.    
  31.                     --Norm 
  32.  
  33.